package cn.kpt.biz.service.impl;

import cn.kpt.beans.pojo.ItripAreaDic;
import cn.kpt.biz.service.AreaDicService;
import cn.kpt.dao.itripareadic.ItripAreaDicMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @version 1.0
 * @ClassName AreaDicServiceImpl
 * @Description TODO
 * @Author kangpengtao
 * @Date 2019/10/16 14:04
 */
@Service
public class AreaDicServiceImpl implements AreaDicService {
    @Resource
    private ItripAreaDicMapper itripAreaDicMapper;
    @Override
    public List<ItripAreaDic> getHotCity(String isChina) throws Exception {
        Map<String, Object> params = new HashMap<>();
        // 查询热门城市
        // 1.确定国内还是国外
        params.put("isChina",isChina);
        // 2.确定是热门城市
        params.put("isHot",1);
        return itripAreaDicMapper.getItripAreaDicListByMap(params);
    }

    @Override
    public List<ItripAreaDic> queryTradeAreaByCityId(Long cityId) throws Exception {
        Map<String, Object> params = new HashMap<>();
        // 城市编号
        params.put("parent",cityId);
        // 是否是商圈
        params.put("isTradingArea",1);
        return itripAreaDicMapper.getItripAreaDicListByMap(params);
    }

    @Override
    public ItripAreaDic getTradingAreaByHotelId(Long hotelId) throws Exception {
        return itripAreaDicMapper.getItripAreaDicByHotelId(hotelId);
    }
}
